[index]

Ask File Command

Syntax: ask file <prompt> [for open] [of type <type>] or ask file <prompt> for save [with <default>] Applies to global

Description

The ask file command displays a standard "Open File" dialog box that lets the user select a filename from the operating system. The user may either type the name of the file or select it from a scrolling list of files. The <prompt> string is displayed in the title bar of the window. The <type> parameter specifies a file type that is automatically used as a filter for the display list (only files with extension <type> are displayed). In Microsoft Windows, <type> represents a file extension and must have exactly three characters. On the Macintosh, <type> represents a file type and must have exactly four characters. If <type> is not specified, all files are listed. The full path name of the selected file is returned in it. The ask file for save command displays a standard "Save File" dialog box that lets the user type in the name of a file. The <default> parameter specifies the default name for the file.

Notes

The ask file for open command does not actually open the selected file. The ask file for save command does not actually save the indicated file, nor does it verify that the specified name is valid.

Examples

The following button handler lets the user open a new stack. If the user clicks on the Cancel button, a new stack is not opened. on mouseUp if the platform is "Windows" then put "STA" into filetype else put "STAK" into filetype end if type filetype if it is not empty then go to stack it end mouseUp Example 2: function read_line_from_file type "WRI" put it into file_name if file_name is not empty then open file file_name read from file file_name until return put it into the_line close file file_name return the_line else return "No file selected."
This text has been mechanically extracted from the Oracle Media Objects 1.0.4.9 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.